package com.trkj.property_controller;

import com.trkj.entity.QianTaiEntity;
import com.trkj.entity.QianTaiHouseCostEntity;
import com.trkj.entity.QianTaiParkCostEntity;
import com.trkj.entity.UserRoleEntity;
import com.trkj.service.QianTaiService;
import com.trkj.vo.AjaxResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@Slf4j
@CrossOrigin
public class QianTaiController {
    @Resource
    private QianTaiService qianTaiService;
    //根据房屋id查房屋的信息
    @PostMapping("/FanWuXinXi/{id}")
    public AjaxResponse FanWuXinXi(@PathVariable ("id") int id){
        return AjaxResponse.success(qianTaiService.FanWuXinXi(id));
    }
    //根据房屋id分页查询房屋费用情况
    @PostMapping("/HouseCost")
    public AjaxResponse HouseCost(@RequestBody QianTaiHouseCostEntity qianTaiHouseCostEntity , int currentPage, int pageSize){
        return AjaxResponse.success(qianTaiService.HouseCost(qianTaiHouseCostEntity,currentPage,pageSize));
    }
    //根据车位id分页查询车位费用情况
    @PostMapping("/ParkCost")
    public AjaxResponse ParkCost(@RequestBody QianTaiParkCostEntity qianTaiParkCostEntity, int currentPage, int pageSize){
        return AjaxResponse.success(qianTaiService.ParkCost(qianTaiParkCostEntity,currentPage,pageSize));
    }
    //根据车辆id分页查询车位费用情况
    @PostMapping("/CarCost")
    public AjaxResponse CarCost(@RequestBody QianTaiParkCostEntity qianTaiParkCostEntity, int currentPage, int pageSize){
        log.debug("车辆{}",qianTaiParkCostEntity);
        return AjaxResponse.success(qianTaiService.CarCost(qianTaiParkCostEntity,currentPage,pageSize));
    }
    @PostMapping("/ShouQuanFei")
    public AjaxResponse ShouQuanFei(@RequestBody() List<Integer> list){
        return AjaxResponse.success(qianTaiService.ShouQuanFei(list));
    }
}
